export default class navigatorUtil {
    /*
       返回上一页
     */
    static goBack = (params) => {
        const {navigation} = params
        navigation.goBack()
    }
    /*
       重置到首页
     */
    static resetToHomePage = (params) => {
        const {navigation} = params
        navigation.navigate('HomePage')
    }
    /**
     * 跳转到指定页面
     * @param params 要传递的参数
     * @param page 要跳转的页面
     */
    static goPage = (params,page) => {
        const navigation = navigatorUtil.navigation
        if(!navigation){
            console.log('navigatorUtil.navigation cannot be null')
            return
        }
        navigation.navigate(page,{...params})
    }
}
